<%@ page language="java"  pageEncoding="UTF-8"%>
<%@ page import="crm.model.Salearea" %>
<%@ page import="crm.control.SaleareaControl"%>
<%@ page import="crm.util.ParamUtil" %>
<%@ page import="java.util.*"  %>
<%@page import="crm.control.EmployeesControl"%>
<%@page import="crm.model.Employees"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>天成科技CRM管理系统</title>
<!--                       CSS                       -->
<!-- Reset Stylesheet -->
<link rel="stylesheet" href="../../../../resources/css/reset.css" type="text/css" media="screen" />
<!-- Main Stylesheet -->
<link rel="stylesheet" href="../../../../resources/css/style.css" type="text/css" media="screen" />
<!-- Invalid Stylesheet. This makes stuff look pretty. Remove it if you want the CSS completely valid -->
<link rel="stylesheet" href="../../../../resources/css/invalid.css" type="text/css" media="screen" />
<!--                       Javascripts                       -->
<!-- jQuery -->
<script type="text/javascript" src="../../../../resources/scripts/jquery-1.3.2.min.js"></script>
<!-- jQuery Configuration -->
<script type="text/javascript" src="../../../../resources/scripts/simpla.jquery.configuration.js"></script>
 <script type="text/javascript" src="../../../../resources/js/WebCalendar.js"></script>
<!-- Facebox jQuery Plugin -->
<script type="text/javascript" src="../../../../resources/scripts/facebox.js"></script>
<!-- jQuery WYSIWYG Plugin -->
<script type="text/javascript" src="../../../../resources/scripts/jquery.wysiwyg.js"></script>
<!-- jQuery Datepicker Plugin -->
<script type="text/javascript" src="../../../../resources/scripts/jquery.datePicker.js"></script>
<script type="text/javascript" src="../../../../resources/scripts/jquery.date.js"></script>
<script type="text/javascript" src="../../../../resources/js/reinitIframe.js"></script>
<script type='text/javascript'>
window.onload=function(){	
	var num=document.getElementById('num').value;
	setInterval(function(){
		new ReinitIframe('iadd');
		new ReinitIframe('iinformation');
		for(var i=1;i<=num;i++){
			var update = 'iupdate' + i;
			new ReinitIframe(update);
		}
	},200);
}
</script>
<style type="text/css">
.hide{
    position: absolute;
    zoom: 0.001;
    -moz-transform: scale(0);
    -webkit-transform: scale(0);
    -o-transform: scale(0);
    transform: scale(0);
}
</style>
</head>
  <body>
  <%
  		request.setCharacterEncoding("UTF-8");
  		Employees cu = (Employees)session.getAttribute("user");
   %>
<div id="body-wrapper">
  <!-- Wrapper for the radial gradient background -->
  <div id="sidebar">
    <div id="sidebar-wrapper">
      <!-- Sidebar with logo and menu -->
      <h1 id="sidebar-title"><a href="#">天成科技CRM管理系统</a></h1>
      <!-- Logo (221px wide) -->
      <a href="#"><img id="logo" src="../../../../resources/css/slice/notice.png" alt="logo" /></a>
      <!-- Sidebar Profile links -->
      <div id="profile-links"> <a href="#"><%=EmployeesControl.getEmployeesName(cu.getId())%>,您好！</a> <br />
        <br />
        <a href="#information" rel='modal' >修改个人信息</a> | <a href="../../../login/logout.jsp" title="Sign Out">注销</a> </div>
      <ul id="main-nav">
        <!-- Accordion Menu -->
        <li> <a href="#" class="nav-top-item current no-submenu">
          <!-- Add the class "no-submenu" to menu items with no sub menu -->
          公司页面 </a>
          <ul>
	          <li><a href='../material/material_download.jsp'>资料 </a></li>
	          <li><a href='../notice/notice.jsp'>公告</a></li>
	          <li><a class='current' href='../salearea/salearea.jsp'>销售区域</a></li>
	          <li><a href='../saletarget/saletarget.jsp'>销售目标</a></li>
	          <li><a href='../../company/show_all_custom_require.jsp'>客户需求登记表</a></li>
          </ul>
           </li>
        <li> <a href="../../recepit/show_all_recepits.jsp" class="nav-top-item no-submenu">
          <!-- Add the class "current" to current menu item -->
           我的跟单</a>
        
        </li>
        <li> <a href="../../offer/show_all_offers.jsp" class="nav-top-item no-submenu">报<span class='letter'>价</span></a>      
        </li>
        <li> <a href="../../bargain/show_all_bargains.jsp" class="nav-top-item no-submenu">合<span class='letter'>同</span></a>
        </li>
        <li> <a href="../../schedule/schedule.jsp" class="nav-top-item no-submenu">日<span class='letter'>程</span></a></li>
        <li> <a href="../../customer/customer.jsp" class="nav-top-item no-submenu">我的客户</a>
        <%
            if(cu.getPosition()!=1){
            	%>
            	<li> <a href="#" class="nav-top-item">统<span class='letter'>计</span></a>
		          <ul>
		            <li><a href="../../../control/statistics/company_statistics.jsp">公司统计</a></li>
		            <li><a href="../../../control/statistics/employees_statistics.jsp">员工统计</a></li>
		          </ul>
		        </li>
            	<li><a href="../../employees/employees.jsp" class="nav-top-item no-submenu">员工管理</a></li>
            	<%
            }
        %>
        </li>
      </ul>
    </div>
  </div>
  <div id="main-content">
  <img src='../../../../resources/css/slice/t.png'/>
  <form action="">
	 <div class="content-box-header">
	 <h3 style="cursor: s-resize;">销售区域</h3>
	 </div>
	 <table border='1'>   
	 <thead> 
     <tr>
  		<th >编号</th>
  		<th >区域名称</th>
  		<th>销售目标</th>
  		<th >竞争对手</th>
  		<th >操作</th>
  </tr>
  </thead>
<tbody>
	<% 	
	    request.setCharacterEncoding("UTF-8");
 		session.removeAttribute("objectid");
 		int pages = ParamUtil.getInt(request, "pages", 1);
		int rowsPerPage = ParamUtil.getInt(request, "pageSize", 10);
		SaleareaControl sc = new SaleareaControl();
		Salearea salearea =new Salearea();
		List<Salearea> list1 = new ArrayList<Salearea>();
		int j = 0;
		list1 = (List) sc.GetSalearea(pages,rowsPerPage,"id");

			for (int i = 0; i < list1.size(); i++) {
				salearea = list1.get(i);
				j++;			
%>
	<tr>
 		<td align = center><%=salearea.getId()%></td>
 		<td align = center><%=salearea.getArea_name()%></td> 		
 		 <td align = center><%=salearea.getSale_target()%></td>
 		<td align = center><%=salearea.getCompetitor()%></td>
 		<td align = center><a href = "#messages<%=j %>" rel='modal'>修改</a> |
 		<a href = "salearea_delete.jsp?id=<%=salearea.getId()%>" onclick='return confirm("确定要删除吗?")'>删除</a>
 		</td>
 	</tr>	
		<div  class='hide' >
			<div id='messages<%=j %>'>
			<iframe id='iupdate<%=j %>' style='width:368px; overflow:hidden;' scrolling='no' frameborder='0' src='salearea_update.jsp?id=<%=salearea.getId()%>'></iframe>
			</div>
		</div>
 		<%
				}
				
		%>
		<input type='hidden' value='<%=j %>' id='num'/>
		</tbody>
   </table>
 	  <%
			out.println(SaleareaControl.pageInstance.getToolsMenu(pages));
	  %>
<br/>
 <a class = "button" href='#add' rel='modal'>添加销售区域</a> 
<div class='hide' >
	<div id='add' style='width:640px;'>
		<iframe id='iadd' style='width:640px; overflow:hidden;' scrolling='no' frameborder='0' src='salearea_add.jsp'></iframe>
	</div>
</div>
<div class='hide' >
	<div id='information'>
		<iframe id='iinformation' style='width:368px; overflow:hidden;' scrolling='no' frameborder='0' src='../../employees/employees_update.jsp'></iframe>
	</div>
</div>		
	 </form>
	 </div>
	 </div>
  </body>
</html>
